package globalVisionEntertainment.nba;

import java.util.Date;

/**
 * 表示一位球员在一节比赛中，一次在场的统计数据。
 * 球员在一节比赛中可以上场下场多次，本类只表示其中的一次。
 * <code>PlayerQuarterStatistic</code>表示球员整一节的统计数据。
 * @author 爱让一切都对了
 *
 */
public class PlayerInQuarterStatistic
{
	private final Date startTime;
	private Date endTime;
	private final String playerName;

	private int plus;
	private int minus;

	public PlayerInQuarterStatistic(String playerName, Date startTime)
	{
		this.startTime = startTime;
		this.playerName = playerName;
	}

	public Date getStartTime()
	{
		return startTime;
	}

	public Date getEndTime()
	{
		return endTime;
	}

	public String getPlayerName()
	{
		return playerName;
	}

	public void setEndTime(Date endTime)
	{
		assert this.endTime == null;

		this.endTime = endTime;
	}

	public Date getOnCourtTime()
	{
		// TODO: maybe should not use Date, since Date is an instance of time, not a period.

		// startTime may be 12:00, endTime be 0:00.
		return new Date(startTime.getTime() - endTime.getTime());

	}

	public int getPlus()
	{
		return plus;
	}

	public void setPlus(int plus)
	{
		assert plus>=0;
		this.plus = plus;
	}

	public int getMinus()
	{
		return minus;
	}

	public void setMinus(int minus)
	{
		assert minus>=0;
		this.minus = minus;
	}

}
